import request from './request';

// 发送消息到AI助手 - 支持文本、图片和模型选择
export const sendAIMessage = (data: { message: string; imageUrl?: string; modelType?: string }) => {
  console.log('发送AI消息请求数据:', data);
  return request({
    url: '/api/ai/chat',
    method: 'post',
    data
  });
};

// 上传文件到服务器
export const uploadFile = (file: File, module?: string) => {
  console.log('上传文件请求，文件名:', file.name);
  const formData = new FormData();
  formData.append('file', file);
  if (module) {
    formData.append('module', module);
  }
  
  return request({
    url: '/api/upload/file',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};